package com.cabrida.livestar.main;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.cabrida.livestar.BaseActivity;
import com.cabrida.livestar.R;
/**
 * 广告web页面
 * 
 * @author why
 * 
 */
public class FansWebActivity extends BaseActivity {
	public static final String TAG = FansWebActivity.class.getSimpleName();
	private WebView webView;
//	private ImageView iv_back;
//	private TextView tv_title;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

	}

	@Override
	protected void findViewById() {
		// TODO Auto-generated method stub
		setContentView(R.layout.activity_web);
		webView = (WebView) findViewById(R.id.webView);
//		iv_back = (ImageView) findViewById(R.id.iv_back);
//		tv_title = (TextView) findViewById(R.id.tv_title);
	}

	@Override
	protected void initView() {
		// TODO Auto-generated method stub
//		iv_back.setOnClickListener(this);
	        webView.setWebViewClient(new WebViewClient() {
	            @Override
	            public boolean shouldOverrideUrlLoading(WebView view, String url) {
	                view.loadUrl(url);
	                return true;
	            }

	            @Override
	            public void onPageFinished(WebView view, String url) {
	                super.onPageFinished(view, url);
	            }
	        });
	        WebSettings webSettings = webView.getSettings();
	        webSettings.setDefaultTextEncodingName("utf-8");
	        webSettings.setJavaScriptEnabled(true);// 设置webView支持js
	        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
	        webSettings.setSupportZoom(true);
	        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);// 不使用缓存，直接从网络加载
	        // webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);//优先使用缓存
	        
	        
	        webView.loadUrl(getIntent().getStringExtra("url"));
	}

	
	

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		super.onClick(v);
		switch (v.getId()) {
//		case R.id.iv_back:
//			this.finish();
//			break;
		default:
			break;
		}
	}

}
